﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jb.Search
{
    public interface ISearcher
    {
        /// <summary>
        /// Optimized for Search Suggestion. Searches only in few fields.
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        System.Collections.Generic.List<Jb.Search.SearchResult> AutoCompleateQuery(String keyword, int pageNo, int pageSize);

        /// <summary>
        /// Designed to work as a Prefix Search, but currently obsolete. Instead AutoCompleteQuery should be used.
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        String PrefixSearch(string keyword, int pageNo, int pageSize);

        /// <summary>
        /// Further refines a Search Result with more specific filter options
        /// </summary>
        /// <param name="payload"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageNo"></param>
        /// <param name="totalRecord"></param>
        /// <returns></returns>
        String RefineSearch(Jb.Search.SearchPayload payload, int pageSize, int pageNo, out int totalRecord);

        /// <summary>
        /// Gets comma separated all item ids matching the keyword.
        /// Though it takes pageSize and pageNo as parameter, but actually it does not have any effect.
        /// Because internally all the matching results are returned.
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageNo"></param>
        /// <param name="totalRecord"></param>
        /// <returns></returns>
        String Search(String keyword, int pageSize, int pageNo, out int totalRecord);

        /// <summary>
        /// Returns all Results without pagination
        /// </summary>
        /// <param name="keyword"></param>
        /// <returns></returns>
        String Search(String keyword);

        /// <summary>
        /// Refreshes the IndexSearcher to obtain latest changes in the search index.
        /// </summary>
        void Reload();
    }
}
